use std::thread; use std::time::Duration; fn main() { // create a thread thread::spawn(|| { for i in 0..5 { println!("hi number {} from the spawned thread!", i); } }); }